<?php 
session_start();
 if (!isset($_SESSION['login']) or !isset($_SESSION['senha'])) {
 	header('location: login.html');
 }

   include "conexao/conexao.php";
?>
<html>
<head>
	<title>SGA - Sistema de Gerenciamento de Almoxarifado - Principal</title>
	<link href="menu_assets/styles.css" rel="stylesheet" type="text/css">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <script type="text/javascript" src="menu_assets/media/js/jquery.dataTables.min.js"></script>
        <script type="text/javascript" src="menu_assets/media/js/jquery.js"></script>
        <link rel="stylesheet" type="text/css" media="screen" href="menu_assets/media/css/demo_page.css" > 
        <link rel="stylesheet" type="text/css" media="screen" href="menu_assets/media/css/demo_table.css" >
</head>
<script type="text/javascript">
function confirmsair(){
		var sair = confirm("Deseja sair?");
		if(sair == true){
			window.location.href="logout.php";
		}
	}
        $(document).ready(function(){
           // alert("sdf");
            //$('#table1').dataTable();
        });
</script>
<body>
      <div id='cssmenu'>
         <ul>
            <li><a href='index.php'><span>Home</span></a></li>
            <li class='has-sub'><a href='#'><span>Funcionarios</span></a>
               <ul>
                  <?php if($_SESSION['permissao'] === "2"){
                     echo "
                         <li><a href='index.php?page=funcionario/novofuncionario.php'><span>Cadastrar Funcionário</span></a></li>
                         <li class='last'><a href='index.php?page=funcionario/funcionario.php'><span>Listar Funcionários</span></a></li>
                         <li class='last'><a href='index.php?page=funcionario/reatvcadastro.php'><span>Reativar Cadastro / Pesquisa de Funcionario</span></a></li>
                     ";
                  } ?>
                   <?php if($_SESSION['permissao'] === "3"){
                     echo "
                      <li class='last'><a href='index.php?page=funcionario/reatvcadastro.php'><span>Pesquisa de Funcionario</span></a></li>
                     ";
                  } ?>              
               </ul>
            </li>
            <li class='has-sub'><a href='#'><span>Ferramenta</span></a>
               <ul>
                   <?php if($_SESSION['permissao'] === "2"){
                     echo "
                         <li><a href='index.php?page=ferramenta/cadastrar.php'><span>Cadastrar Ferramenta</span></a></li>";
                      }

                     if($_SESSION['permissao'] == "3" || $_SESSION['permissao'] === "1"){
                        echo "
                        <li class='last'><a href='index.php?page=ferramenta/listar.php'><span>Listar Ferramentas</span></a></li>
                         <li class='last'><a href='index.php?page=ferramenta/pesquiferramen.php'><span>Pesquisar Ferramenta</span></a></li>
                        ";
                        }
                       if($_SESSION['permissao'] === "2"){
                        echo "
                        <li class='last'><a href='index.php?page=ferramenta/listar.php'><span>Listar Ferramentas</span></a></li>
                         <li class='last'><a href='index.php?page=ferramenta/pesquiferramen.php'><span>Pesquisar Ferramenta / Editar Ferramenta</span></a></li>
                        ";
                        }
                      ?>  
                  
               </ul>
            </li>
            <li class='has-sub'><a href='#'><span>Requisições</span></a>
               <ul>
                <?php if($_SESSION['permissao'] === "2" || $_SESSION['permissao'] === "3"){
                     echo "
                         <li><a href='index.php?page=requisicao/requisicao.php'><span>Nova Requisição</span></a></li>
                         <li class='last'><a href='index.php?page=requisicao/listarequisicao.php'><span>Listar Requisições</span></a></li>
                         ";
                      }
                ?>
               </ul>
            </li>
            <li class='last'><a href='#' onclick="confirmsair()"><span>Sair</span></a></li>
            <li class='last'><a href='index.php?page=index2.php' ><span>pj</span></a></li>
         </ul>
      </div>
      <div id="content">
         <?php 
            if (isset($_GET['page']) || !empty($_GET['page'])) {
               $page = $_GET['page'];
               include ($page);
            
            }
         ?>
      </div>
</body>
</html>